﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NBehave.Narrator.Framework;
using NBehave.Spec.NUnit;
using NH.OpenClosedPrinciple.FirstAttempt;
using NUnit;
using NUnit.Framework;
using NBehave.Narrator.Framework;

namespace NH.OpenClosedPrinciple.FirstAttempt
{
	[Theme("OCP: Exploring Open Closed Principle"), TestFixture]
	public class ProductFilterFixture : FixtureBase
	{

		[Test]
		public void Should_filter_the_products_by_color()
		{
			IList<Product> productLists = null;
			IEnumerable<Product> result = null;

			ProductFilter productFilter = new ProductFilter();
			story
				.WithScenario("Filter by color")
				.Given("Initial an list of products",
				       () => productLists = BuildProductList())
				.And("a productFilter class",
				     () => productFilter = new ProductFilter())
				
				.When("I filter by ProductColour:$color", ProductColour.Blue,
				      (ProductColour color) => result = productFilter.ByColor(productLists, color))

				.Then("I expect a result with a count of $count", 4,
					  (int pExpectedCount) => result.Count().ShouldEqual(pExpectedCount));
		}
	}
}